/**
 * 枚举类型: 顾客记录(时间线) 类型
 */
const RecordType = {
  CONSULTATION: { id: 0, name: '咨询' },
  FOLLOW_UP: { id: 1, name: '回访' },
  EMPOWERMENT: { id: 2, name: '赋能' },
  CUSTOMER_RELATIONSHIP: { id: 3, name: '客情' },
  FACIAL: { id: 4, name: '面部' },
  ACTIVITY: { id: 5, name: '活动' },
  REPLAY: { id: 6, name: '复盘' },
  APPLY_ORDER: { id: 7, name: '会诊' },
  IMAGE: { id: 11, name: '图片' },
  AUDIO: { id: 12, name: '音频' },

  /**
   * 通过时间线类型 id, 获取对应的枚举
   * @param {number} id 时间线类型 id
   * @return {Object | undefined}
   */
  getById: function (id) {
    return Object.values(RecordType)
      .filter(x => x && typeof x !== 'function')
      .find(x => x.id === id);
  },

  /**
   * 通过时间线类型名, 获取对应的枚举
   * @param {string} name 时间线类型名
   * @return {Object | undefined}
   */
  getByName: function (name) {
    return Object.values(RecordType)
      .filter(x => x && typeof x !== 'function')
      .find(x => x.name === name);
  },
};

Object.freeze(RecordType);

export default RecordType;
